import { screenProportion } from '@/api/screen'

export default function useEnergyStructurePieChart() {
  const data = ref<{
    name: string
    data: { name: string, value: string | number }[]
  }>({
    name: '',
    data: [],
  })

  const getEnergyStructurePieChart = async () => {
    try {
      const res = await screenProportion()
      res.data && (data.value = res.data)
    }
    catch (e) {
      console.warn(e)
    }
  }
  return {
    data,
    getEnergyStructurePieChart,
  }
}
